package com.pengtu.gsj.dao.system;

import java.util.List;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import com.pengtu.gsj.dao.hibernate.HibernateDao;
import com.pengtu.gsj.entity.app.Trajectory;

@Repository
public class TrajectoryDao extends HibernateDao<Trajectory, String> {

	/**
	 * 获取当前用户最近的10条轨迹路径
	 * getTrajectories:
	 * 适用:
	 * @return 
	 * @exception 
	 * @since  1.0.0
	 */
	@SuppressWarnings("unchecked")
	public List<Trajectory> getTrajectories(String userId) {
		String hql = "from Trajectory t where t.delFlag = '0' and t.userId =? order by t.operateTime DESC ";
		Query query = getSession().createQuery(hql);
		query.setString(0, userId);
		query.setFirstResult(0);
		query.setMaxResults(10);
		return query.list();
	}
}
